package com.wang.demo06;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class ProxyInvocationHandler implements InvocationHandler {

    private Object proxyclass;

    public void setProxyclass(Object proxyclass) {
        this.proxyclass = proxyclass;
    }


    public Object getProxy(){
        return Proxy.newProxyInstance(this.getClass().getClassLoader(),proxyclass.getClass().getInterfaces(),this);
    }


    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        Object result=method.invoke(proxyclass,args);
        return result;
    }
}
